<?php
namespace App\Common\Cla\ClaBase\Traits\DataModel;

use App\Common as com;

trait QuickGetData {

	/**
	 * 快速查询
	 * @param obj $model_obj 模型对象
	 * @return obj $model_obj
	 */
	protected static function quickGetData( $model_obj, array $param = [] ){
		// 传入参数where
		if( isset( $param['where'] ) ){
			$model_obj = $model_obj->where( $param['where'] );
		}
		// 执行->查询闭包
		if ( isset( $param['model_callback'] ) && $param['model_callback'] instanceof \Closure ) {
			$param['model_callback']( $model_obj );
		}
		// 执行->where闭包
		if ( isset( $param['where_callback'] ) && $param['where_callback'] instanceof \Closure ) {
			$model_obj->where( $param['where_callback'] );
		}
		//
		return $model_obj;
	}

}
